import logging
import redis


# 添加配置信息
class Config(object):

    # 数据库的配置信息
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/demo5'
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    # 密钥
    SECRET_KEY = 'YWR4wbkMydQ/2mA6WYxQysPauQfFWCccdHjPbSgdYTXzs4LSrwLuIgPLFcai'
    # flask_session的配置信息
    SESSION_TYPE = 'redis'
    SESSION_USE_SIGNER = True
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    PERMNEENT_SESSION_LIFETIME = 86400
    # 日志
    LOG_LEVEL = logging.DEBUG


class DevelopmentConfig(Config):
    '开发模式下的配置'
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


class ProductionConfig(Config):
    '生产模式下的配置'
    DEBUG = False
    LOG_LEVEL = logging.ERROR
